const a = async function (
  _0,
  { $grid },
  _2,
  { dc: { http, reload, message, Confirm, store }, dayjs }
) {
  const checkList = $grid.getCheckboxRecords();
  const ret = await new Promise((resolve) => {
    Confirm({
      iconType: "info",
      title: "提醒欠费学生",
      content: "该操作将提醒已勾选班级的欠费学生,是否继续?",
      onOk: async () => resolve(true),
      onCancle: async () => resolve(false),
    });
  });
  if (!ret) return;
  const year = dayjs(store.get("user", "date")).format("YYYY");
  await http.post({
    url: "/ypxy/cwzn/pushStudentNoPay",
    data: { year, bjdm: checkList.map((i) => i.bjdm) },
  });
  message.success("提醒成功");
  reload();
};

const a2 = async function (e, { $grid }, d, { dc: { open } }) {
  const uuid = "8a7162b505494586a88e30733859b117";
  const layout = { id: uuid };
  const modal = {
    title: "发送欠缴通知",
    width: "55vw",
    minHeight: document.body.clientHeight * 0.55,
    defaultFullscreen: false,
    destroyOnClose: true,
    centered: true,
    open: true,
    showOkBtn: false,
    showCancelBtn: true,
    wrapClassName: "-no-footer",
  };
  const transfer = {
    ["e78916b0ebe0426795181cdf3b791a99"]: $grid.getCheckboxRecords(),
  };
  console.log("$grid", transfer);
  open({ layout, modal, transfer });
};

const a1 = async function (
  _0,
  { $grid },
  _2,
  { dc: { http, reload, message } }
) {
  const checkList = $grid.getCheckboxRecords();
  console.log(checkList);

  const {
    code,
    message: errorMessage,
    msg,
  } = await http.form(
    { url: "/nyk/program/deleteProgram", data: { id } },
    { isTransformResponse: false }
  );
  if (code === 200) {
    message.success("删除成功");
    reload();
  } else {
    message.error(errorMessage || msg);
  }
};

const b = async function (e, { $grid }, d, { dc: { open } }) {
  const uuid = "8a7162b505494586a88e30733859b117";
  const layout = { id: uuid };
  const modal = {
    title: "发送欠缴通知",
    width: "55vw",
    minHeight: document.body.clientHeight * 0.55,
    defaultFullscreen: false,
    destroyOnClose: true,
    centered: true,
    open: true,
    showOkBtn: false,
    showCancelBtn: true,
    wrapClassName: "-no-footer",
  };
  const transfer = {
    ["e78916b0ebe0426795181cdf3b791a99"]: $grid.getCheckboxRecords(),
  };
  console.log("$grid", transfer);
  open({ layout, modal, transfer });
};
